home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / syscall / Fs_Select.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-21  |  2.0 KB  |  67 lines

  1. /* 
  2.  * Fs_Select.c --
  3.  *
  4.  *    Source code for the Fs_Select library procedure.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: Fs_Select.c,v 1.2 88/06/21 11:17:08 ouster Exp $ SPRITE (Berkeley)";
  18. #endif not lint
  19.  
  20. #include <sprite.h>
  21. #include <fs.h>
  22. #include <status.h>
  23.  
  24.  
  25. /*
  26.  *----------------------------------------------------------------------
  27.  *
  28.  * Fs_Select --
  29.  *
  30.  *      The "normal" Fs_Select interface for user code.  Waits a period of
  31.  *      time  indicated  by  *timeoutPtr for  I/O  to become possible on
  32.  *      any of the streams indicated by *readMaskPtr,  *writeMaskPtr and
  33.  *      *exceptMaskPtr.
  34.  *
  35.  * Results:
  36.  *    The result from Fs_RawSelect.
  37.  *
  38.  * Side effects:
  39.  *    None.
  40.  *
  41.  *----------------------------------------------------------------------
  42.  */
  43.  
  44. ReturnStatus
  45. Fs_Select(numStreams, timeoutPtr, readMaskPtr, writeMaskPtr,
  46.            exceptMaskPtr, numReadyPtr)
  47.  
  48.     int        numStreams;    /* # of bits in the read and write masks. */
  49.     Time    *timeoutPtr;    /* Timeout period or NULL. */
  50.     int        *readMaskPtr;    /* A bitmask indicating stream ID's to check
  51.                  * for readability. */
  52.     int        *writeMaskPtr;    /* A bitmask indicating stream ID's to check
  53.                  * for writability. */
  54.     int        *exceptMaskPtr;    /* A bitmask indicating stream ID's to check
  55.                  * for exception conditions. */
  56.     int        *numReadyPtr;    /* On return indicates the number of streams
  57.                  * ready for I/O. */
  58. {
  59.     ReturnStatus    status;
  60.  
  61.     do {
  62.     status = Fs_RawSelect(numStreams, timeoutPtr, readMaskPtr, writeMaskPtr,
  63.                exceptMaskPtr, numReadyPtr);
  64.     } while (status == GEN_ABORTED_BY_SIGNAL);
  65.     return(status);
  66. }
  67.